package ua.ck.example.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import ua.ck.example.dao.OrderDAO;
import ua.ck.example.dao.OrderDetailDAO;
import ua.ck.example.domain.Order;
import ua.ck.example.domain.OrderDetail;

@Service("orderService")
public class OrderServiceImpl implements OrderService {
	@Autowired
	private OrderDAO orderDAO;

	@Autowired
	private OrderDetailDAO orderDetailDAO;

	@Override
	@Transactional
	public List<Order> listOrders() {
		return orderDAO.listOrders();
	}

	@Override
	@Transactional
	public void addOrder(Order order) {
		orderDAO.addOrder(order);

	}

	@Override
	@Transactional
	public List<Order> getOrders(Order order) {
		return orderDAO.getOrders(order);
	}

	@Override
	@Transactional
	public void delOrder(Order order) {
		orderDAO.delOrder(order);

	}

	@Override
	@Transactional
	public void updateOrder(Order order) {
		orderDAO.updateOrder(order);

	}

	@Override
	@Transactional
	public List<Order> getUnconfirmOrders() {
		return orderDAO.getUnconfirmOrders();
	}

	@Override
	@Transactional
	public void addOrderDetail(OrderDetail orderDetail) {
		orderDetailDAO.addOrderDetail(orderDetail);

	}
}
